<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" layout:decorate="main"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>客户信息管理</title>
    <link th:href="@{/localcss/crmlist.css}" href="../static/localcss/crmlist.css" rel="stylesheet">
</head>
<body>
<div layout:fragment="content">
    <div class="">
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>
                            营销机会管理 <i class="fa fa-user"></i>
                            <small>
                                - 您可以通过搜索或者其他的筛选项对用户的信息进行编辑、删除等管理操作。^_^
                            </small>
                        </h2>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <form method="get" action="/crm/customer/list">
                            <input type="hidden" name="pageIndex" value="1">
                            <ul>
                                <li>
                                    <div class="form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">公司名称</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <input name="custName" type="text" class="form-control col-md-6 col-xs-12"
                                                   value="">
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <div class="form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12">地区</label>
                                        <div class="col-md-6 col-sm-6 col-xs-12">
                                            <select name="custRegion" id="roleId" class="form-control">
                                                <option value="">--请选择--</option>
                                                <option value="河北">河北</option>
                                                <option value="北京">北京</option>
                                                <option value="东北">东北</option>
                                                <option value="中南">中南</option>
                                                <option value="上海">上海</option>
                                            </select>
                                        </div>
                                    </div>
                                </li>
                                <li>
                                    <button type="submit" class="btn btn-primary"> 查 &nbsp;&nbsp;&nbsp;&nbsp;询</button>
                                </li>
                            </ul>
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_content">
                        <p class="text-muted font-13 m-b-30"></p>
                        <div id="datatable-responsive_wrapper"
                             class="dataTables_wrapper form-inline dt-bootstrap no-footer">
                            <div class="row">
                                <div class="col-sm-12">
                                    <table id="datatable-responsive"
                                           class="table table-striped table-bordered dt-responsive nowrap dataTable no-footer dtr-inline collapsed"
                                           cellspacing="0" width="100%" role="grid"
                                           aria-describedby="datatable-responsive_info" style="width: 100%;">
                                        <thead>
                                        <tr role="row">
                                            <th class="sorting_asc" tabindex="0" aria-controls="datatable-responsive"
                                                rowspan="1" colspan="1"
                                                aria-label="First name: activate to sort column descending"
                                                aria-sort="ascending">客户编号
                                            </th>

                                            <th class="sorting" tabindex="0" aria-controls="datatable-responsive"
                                                rowspan="1" colspan="1"
                                                aria-label="Last name: activate to sort column ascending">
                                                公司
                                            </th>

                                            <th class="sorting" tabindex="0" aria-controls="datatable-responsive"
                                                rowspan="1" colspan="1"
                                                aria-label="Last name: activate to sort column ascending">
                                                地区
                                            </th>

                                            <th class="sorting" tabindex="0" aria-controls="datatable-responsive"
                                                rowspan="1" colspan="1"
                                                aria-label="Last name: activate to sort column ascending">
                                                客户经理/负责人
                                            </th>

                                            <th class="sorting" tabindex="0" aria-controls="datatable-responsive"
                                                rowspan="1" colspan="1"
                                                aria-label="Last name: activate to sort column ascending">
                                                客户等级
                                            </th>
                                            <!--                                            <th class="sorting" tabindex="0"-->
                                            <!--                                                aria-controls="datatable-responsive" rowspan="1" colspan="1"-->
                                            <!--                                                aria-label="Last name: activate to sort column ascending">-->
                                            <!--                                                操作-->
                                            <!--                                            </th>-->
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr role="row" class="odd" th:each="customer:${customerPage.list}">
                                            <td tabindex="0" class="sorting_1" th:text="${customer.custNo}">
                                                KH071207032218638
                                            </td>
                                            <td tabindex="0" class="sorting_1" th:text="${customer.custName}">
                                                聪海信息科技有限公司
                                            </td>
                                            <td tabindex="0" class="sorting_1" th:text="${customer.custRegion}">河北</td>
                                            <td tabindex="0" class="sorting_1" th:text="${customer.custManagerName}">
                                                hlliu
                                            </td>
                                            <td tabindex="0" class="sorting_1" th:text="${customer.custLevelLabel}">
                                                合作伙伴
                                            </td>
                                            <td>
                                                <div class="btn-group">
                                                    <button type="button" class="btn btn-danger">点击操作</button>
                                                    <button type="button" class="btn btn-danger dropdown-toggle"
                                                            data-toggle="dropdown" aria-expanded="false">
                                                        <span class="caret"></span>
                                                        <span class="sr-only">Toggle Dropdown</span>
                                                    </button>
<!--                                                    <ul class="dropdown-menu" role="menu">-->
<!--                                                        <li><a class="editInfo" href="#"-->
<!--                                                               th:href="@{/customer/edit(customercId=${customer.custNo})}"-->
<!--                                                               data-toggle="tooltip" data-placement="top" title=""-->
<!--                                                               data-original-title="编辑"-->
<!--                                                        >编辑</a></li>-->
<!--&lt;!&ndash;                                                        shiro:hasPermission="用户编辑"&ndash;&gt;-->
<!--                                                        <li><a class="delInfo" id="del" th:onclick="|javascript:doDel(this,${customer.custNo})|"-->
<!--                                                        data-toggle="tooltip" data-placement="top" title=""-->
<!--                                                        data-original-title="删除">删除</a></li>-->
<!--                                                        &lt;!&ndash;shiro:hasPermission="用户删除"&ndash;&gt;-->
<!--                                                    </ul>-->
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-5">
                                    <div class="dataTables_info" id="datatable-responsive_info"
                                         role="status" aria-live="polite">共<span
                                            th:text="${customerPage.total}">1</span>条记录
                                        <span th:text="${customerPage.current}">1</span>/<span
                                                th:text="${customerPage.pages}">5</span>页
                                    </div>
                                </div>
                                <div class="col-sm-7">
                                    <span th:text="${message}" class="font-16" style="color: #ff0000">ss</span>
                                    <div class="dataTables_paginate paging_simple_numbers"
                                         id="datatable-responsive_paginate">

                                        <ul class="pagination">

                                            <li class="paginate_button previous"><a
                                                    href="javascript:page_nav(document.forms[0],1);"
                                                    aria-controls="datatable-responsive" data-dt-idx="0"
                                                    tabindex="0">首页</a>
                                            </li>
                                            <li class="paginate_button "><a
                                                    th:href="@{/crm/customer/list(currPageNo=${customerPage.current}-1)}"
                                                    aria-controls="datatable-responsive" data-dt-idx="1"
                                                    tabindex="0">上一页</a>
                                            </li>
                                            <li class="paginate_button "><a
                                                    th:href="@{/crm/customer/list(currPageNo=${customerPage.current}+1)}"
                                                    aria-controls="datatable-responsive" data-dt-idx="2"
                                                    tabindex="0">下一页</a>
                                            </li>
                                            <li class="paginate_button next"><a
                                                    th:href="@{/crm/customer/list(currPageNo=${customerPage.pages})}"
                                                    aria-controls="datatable-responsive" data-dt-idx="7"
                                                    tabindex="0">最后一页</a>
                                            </li>

                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script layout:fragment="js"></script>
<script>
    function doDel(obj,custNo) {
        if (confirm("你确定删除该数据吗？")){
            $.ajax({
                type: "GET",
                url: "/crm/customer/del"+custNo,
                dataType: "json",
                success:function (data) {
                    if (data.delResult=="true"){
                        alert("删除成功");
                        $(obj).parent("tr").remove();
                    }
                },
                error:function () {
                    alert("删除失败");
                }
            })
        }
    }
</script>
</html>